
<block name="content">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Form</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
</head>
<style>

td{
      margin-top:10px;     
    
}
</style>
<body>
    <div id="form1" >
        <!--<input name="id" class="mini-hidden"  value="{$data.item_id}"/>-->
        <table cellspacing='10' style="width: 700px; border-spacing:0px 10px;" >

			 <tr>
                <td>
                    <label for="textbox1$text">品牌及名称：</label>
                </td>
                <td>
                    <input id="product_name"  name="product_name" class="mini-textbox" required  width='250px' value ="{$data.product_name}"/>
                    <!--(建议命名规则:品牌+物料+型号)-->
                </td>
            </tr>

            <tr>
                <td>
                    <label for="textbox1$text">中行礼品id：</label>
                </td>
                <td>
                    <input  id="product_id"  name="product_id" class="mini-textbox" readonly  width='250px' value ="{$data.product_id}"/>
                </td>
            </tr>
            
            
            <tr>
                <td>
                    <label for="textbox1$text">sap编码：</label>
                </td>
                <td>
                    <input  id="sap_item_code"  name="sap_item_code" class="mini-textbox"  width='250px' value ="{$data.sap_item_code}"/>
                </td>
            </tr>

            <tr>
                <td>
                    <label for="textbox1$text">规格或型号：</label>
                </td>
                <td>
                    <input  id="product_spec"  name="product_spec" class="mini-textbox" required width='250px'  value ="{$data.product_spec}"/>
                </td>
            </tr>

            <tr>
                <td>
                    <label for="textbox1$text">上架礼品积分值：</label>
                </td>
                <td>
                    <input id="product_quality"  name="product_quality" class="mini-textbox" required width='250px'  value ="{$data.product_quality}"/>
                </td>
            </tr>

            <tr>
                <td>
                    <label for="textbox1$text">上架礼品名称：</label>
                </td>
                <td>
                    <input  id="sale_name"  name="sale_name" class="mini-textbox" required width='250px'  value ="{$data.sale_name}"/>
                </td>
            </tr>
            
           
              <tr>
                <td>
                    <label for="textbox1$text">库存：</label>
                </td>
                <td>
                <input name="stock_number" id='stock_number'  <if condition="$data.type eq 1">readonly</if> class="mini-textbox" value="{$data.stock_number}"  width="250px" />
                    
                </td>
            </tr>
            
            
            
              <tr>
                <td>
                    <label for="textbox1$text">类型：</label>
                </td>
                <td>
                <select name='type' id="type" class="form-control" >
                    <option value=1 <if condition="$data.stock_type eq 1">selected</if> >sap库存</option>
                    <option value=2 <if condition="$data.stock_type eq 2">selected</if> >手动库存</option>
                </select>
                    
                </td>
            </tr>
            
            
            
              <tr>
                <td>
                    <label for="textbox1$text">是否上架：</label>
                </td>
                <td>
                
                <select name='enable' id="enable" class="form-control" >
                    <option value=1 <if condition="$data.enable eq 1">selected</if> >是</option>
                    <option value=2 <if condition="$data.enable eq 2">selected</if> >否</option>
                </select>
                  
                    
                </td>
            </tr>
            
            
			<tr>
                <td>
                    
                </td>
                <td>

                    <a class='mini-button' onClick="submitForm(1)" >保存</a>
                    
                    <!--CloseWindow()-->
                                                          
                    
                </td>
            </tr>
            
        </table>
    </div>
    <script type="text/javascript">
        mini.parse();
        function submitForm(tag) {
            //提交表单数据
            var form = new mini.Form("#form1"); 
            form.validate();
            if (form.isValid() == false) return;

            //save begin
//            if ($(".uploader .tbody").length > 0)  {
//            }
//            else {
//                mini.alert("必须上传相关附件！");
//                return;
//            }

            //确认提示
            mini.confirm("确定修改记录？", "确定？",
                function (action) {
                    if (action == "ok") {
                        //var data = form.getData();      //获取表单多个控件的数据
						  var  myselect=document.getElementById("type");
                          var index=myselect.selectedIndex ;             // selectedIndex代表的是你所选中项的index
						  var type=myselect.options[index].value;
						  var product_name = mini.get('product_name').getValue();
						  var product_id = mini.get('product_id').getValue();
						  var product_spec = mini.get('product_spec').getValue();
						  var product_quality = mini.get('product_quality').getValue();
						  var sale_name = mini.get('sale_name').getValue();
						  var stock_number = mini.get('stock_number').getValue();
						  var stock_number = mini.get('stock_number').getValue();
						  var  myselect1=document.getElementById("enable");
                          var index1=myselect1.selectedIndex ;             // selectedIndex代表的是你所选中项的index
						  var enable=myselect1.options[index1].value;
						  var sap_item_code = mini.get('sap_item_code').getValue();
						  
                        $.ajax({
							url:"/index.php?m=&c=Order&a=editingboc365",
                            type: "post",
                            data: {type: type,product_name: product_name,product_id:product_id,product_spec:product_spec,product_quality:product_quality,sale_name:sale_name,stock_number:stock_number,id:id,enable:enable,sap_item_code:sap_item_code},
                            dataType: 'json',
                            success: function (data) {
                                mini.alert(data.msg);
                                //CloseWindow();
                            }
                        });

                    } else {
                    }
                });

           // save end

        }
     
		
   function CloseWindow(action) {

       if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
       else window.close();
	   //location.href=document.referrer;
    }

    </script>
   
</body>
</html>

</block>
<block name="js">
	<script type="text/javascript">
		function save() {
			sendForm("form_data", "{:U('save')}", "{:U('index')}");
		}
	</script>
</block>